package com.edu.web;

import com.edu.Service.Impl.UserServiceImpl;
import com.edu.Service.UserService;
import com.edu.entity.User;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/RegisterServlet")
public class RegisterServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        String name=request.getParameter("userName");
        String pass=request.getParameter("userPass");
        String trueName=request.getParameter("name");

        User user=new User(name,pass,trueName);
        UserService userservice=new UserServiceImpl();
        userservice.insertUser(user);

        response.sendRedirect("success.jsp");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
